Skip to content

gh-92356: Fix regression in ctypes function call overhead#92357

Merged
JelleZijlstra merged 1 commit intopython:mainfrom
mdboom:fix-ctypes_init_fielddesc
May 6, 2022
Merged

gh-92356: Fix regression in ctypes function call overhead#92357
JelleZijlstra merged 1 commit intopython:mainfrom
mdboom:fix-ctypes_init_fielddesc

Conversation

@mdboom
Copy link
Copy Markdown
Contributor

@mdboom mdboom commented May 5, 2022

38f331d introduced a delayed initialization routine to set up
ctypes formattable (_ctypes_init_fielddesc), but inadvertently
removed setting the initialization flag to 1 to avoid initting
each time.

Cc: @tiran

#92356

@ghost
Copy link
Copy Markdown

ghost commented May 5, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link
Copy Markdown

Every change to Python requires a NEWS entry.

Please, add it using the blurb_it Web app or the blurb command-line tool.

38f331d introduced a delayed initialization routine to set up
ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently
removed setting the `initialization` flag to 1 to avoid initting
each time.
@mdboom mdboom force-pushed the fix-ctypes_init_fielddesc branch from 27b4aeb to 9486b1e Compare May 5, 2022 23:25
@brandtbucher
Copy link
Copy Markdown
Member

Nice find!

@AlexWaygood AlexWaygood added topic-ctypes type-bug An unexpected behavior, bug, or error performance Performance or resource usage labels May 5, 2022
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

I wonder if this initialization will give us thread safety problems for subinterpreters and/or nogil. Seems like it would have data races.

@JelleZijlstra JelleZijlstra merged commit adcb6a6 into python:main May 6, 2022
@tiran
Copy link
Copy Markdown
Member

tiran commented May 6, 2022

Thanks, Mike!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage topic-ctypes type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants